<?php
$schedules = $variables['schedules'];
$filter = $variables['filter'];
?>
<div class="schedule-wrapper">
	<div class="schedule-header">
		<table width="100%">
			<tr>
				<td width="25%" class="left">Itinerary</td>
				<td><?php print $filter['from'] . ' - ' . $filter['to']?></td>
			</tr>
			<tr>
				<td class="left">Number of passenger:</td>
				<td><?php print $filter['adults'] . ' Adult - ' . $filter['children'] . ' Children - ' . $filter['infants'] . ' Infant'?></td>
			</tr>
			<tr>
				<td class="left">Departing:</td>
				<td><?php print date('l d F Y', strtotime($filter['departure']))?></td>
			</tr>
		</table>
	</div>
	<div class="schedule-table-wrapper">
		<table width="100%">
			<thead>
				<tr>
					<th class="first left"><div class="left_left"><div class="th-content">Train name</div></div></th>
					<th class="left"><div class="th-content">Departure</div></th>
					<th class="left"><div class="th-content">Arrival</div></th>
					<th class="last left"><div class="left_right"><div class="th-content duration">Duration</div></div></th>
					<th class="right first"><div class="right_left"><div class="right_right"><div class="th-content">Hard Seat</div></div></div></th>
					<th class="right"><div class="right_left"><div class="right_right"><div class="th-content">Soft Seat</div></div></div></th>
					<th class="right"><div class="right_left"><div class="right_right"><div class="th-content">Hard Berth</div></div></div></th>
					<th class="right last"><div class="right_left"><div class="right_right"><div class="th-content">Soft Berth</div></div></div></th>
				</tr>
			</thead>
		<?php foreach($schedules as $schedule) { ?>
			<tr>
				<td class="left"><?php print $schedule->name?></td>
				<td class="left"><?php print $schedule->departure?></td>
				<td class="left"><?php print $schedule->arrival?></td>
				<td class="left"><?php print $schedule->duration?></td>
				<td class="right first">
				<?php 
					if(!$schedule->hard_seat) {
						print 'N/A';
					} else {
						print '$ ' . $schedule->hard_seat;
					}
				?>
				</td>
				<td class="right">
				<?php 
					if(!$schedule->soft_seat) {
						print 'N/A';
					} else {
						print '$ ' . $schedule->soft_seat;
					}
				?>					
				</td>
				<td class="right">
				<?php 
					if(!$schedule->hard_berth) {
						print 'N/A';
					} else {
						print '$ ' . $schedule->hard_berth;
					}
				?>					
				</td>
				<td class="right">
				<?php 
					if(!$schedule->soft_berth) {
						print 'N/A';
					} else {
						print '$ ' . $schedule->soft_berth;
					}
				?>					
				</td>
			</tr>
		<?php } ?>
		</table>
	</div>
</div>